﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

namespace BitTorrentSharp.Client
{
	/// <summary>
	/// Represent as a raw message received by a friend. The message is complete but has not been decoded.
	/// </summary>
	public class RawMessage
	{
		#region Fields and Properties

		/// <summary>
		/// Get the length of the message.
		/// </summary>
		public int Length
		{
			get
			{
				return this.Data.Length;
			}
		}

		/// <summary>
		/// Get the data of the message.
		/// </summary>
		public byte[] Data
		{
			get;
			private set;
		}

		#endregion

		/// <summary>
		/// Initialize a new instance of a raw message.
		/// </summary>
		/// <param name="data">The data of the message.</param>
		public RawMessage(byte[] data)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}

			Contract.EndContractBlock();

			this.Data = data;
		}
	}
}
